<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateTopicOperationLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('topic_operation_logs', function (Blueprint $table) {
            $table->id();
            $table->integer('tid')->index();
            $table->integer('type')->index();
            $table->integer('uid')->index();
            $table->tinyInteger('is_latest')->default(0)->comment('是否最新');
            $table->string('request_id')->index();
            $table->string('username');
            $table->string('remarks')->nullable()->comment('说明');
            $table->text('extra')->nullable()->comment('额外信息');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('topic_operation_logs');
    }
}
